package com.xmtlxx.wms.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xmtlxx.common.annotation.DataColumn;
import com.xmtlxx.common.annotation.DataPermission;
import com.xmtlxx.common.core.mapper.BaseMapperPlus;
import com.xmtlxx.wms.domain.Pick;
import com.xmtlxx.wms.domain.bo.OutboundHandoverBo;
import com.xmtlxx.wms.domain.bo.PickBo;
import com.xmtlxx.wms.domain.vo.PickVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 挑拣任务Mapper接口
 *
 * @author xmtlxx
 * @date 2022-08-15
 */
public interface PickMapper extends BaseMapperPlus<PickMapper, Pick, PickVo> {

    /**
     * 根据条件分页查询挑拣任务
     *
     * @param pick 挑拣任务
     * @return Page Pick
     */
    @DataPermission({
            @DataColumn(key = "tenantName", value = "p.create_by"),
            @DataColumn(key = "deptName", value = "p.dept_id"),
            @DataColumn(key = "userName", value = "p.create_by")
    })
    Page<PickVo> selectPagePickList(@Param("page") Page<Pick> page, @Param("pick") PickBo pick);

    /**
     * 查询挑拣任务列表
     *
     * @param pick 挑拣任务
     * @return 挑拣任务集合
     */
    @DataPermission({
            @DataColumn(key = "tenantName", value = "p.create_by"),
            @DataColumn(key = "deptName", value = "p.dept_id"),
            @DataColumn(key = "userName", value = "p.create_by")
    })
    List<PickVo> selectPickList(@Param("pick") PickBo pick);

    PickVo selectPickVoByID(String id);

    PickVo queryPickVoByExWarehouseID(String id);

    /**
     * 获取出库交接
     * @author hergreen
     * @date 2024/10/31 17:36
     * @param page 分页
     * @param ew Wrapper
     * @return com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.xmtlxx.wms.domain.bo.OutboundHandoverBo>
     */
    @DataPermission({
            @DataColumn(key = "tenantName", value = "p.create_by"),
            @DataColumn(key = "deptName", value = "p.dept_id"),
            @DataColumn(key = "userName", value = "p.create_by")
    })
    Page<OutboundHandoverBo> getOutboundHandoverList(@Param("page") Page<Object> page,
                                                     @Param(Constants.WRAPPER) Wrapper<Object> ew);

}
